{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Collecting Info on A Specific Teams Games Over a Specific Period\n",
    "===\n",
    "\n",
    "This vignette shows you how to collect gameids for a specific team during a specific time and aggregate corresponding box score information. \n",
    "\n",
    "Specifically, it will walk you through collecting information on all Phoenix Suns games that took place during December and January of the 2006-07 season."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'1.0.1'"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import goldsberry\n",
    "import pandas as pd\n",
    "pd.set_option(\"display.max_columns\",50) # Change Pandas Display Options\n",
    "goldsberry.__version__"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AST</th>\n",
       "      <th>BLK</th>\n",
       "      <th>DREB</th>\n",
       "      <th>FG3A</th>\n",
       "      <th>FG3M</th>\n",
       "      <th>FG3_PCT</th>\n",
       "      <th>FGA</th>\n",
       "      <th>FGM</th>\n",
       "      <th>FG_PCT</th>\n",
       "      <th>FTA</th>\n",
       "      <th>FTM</th>\n",
       "      <th>FT_PCT</th>\n",
       "      <th>GAME_DATE</th>\n",
       "      <th>GAME_ID</th>\n",
       "      <th>MATCHUP</th>\n",
       "      <th>MIN</th>\n",
       "      <th>OREB</th>\n",
       "      <th>PF</th>\n",
       "      <th>PLUS_MINUS</th>\n",
       "      <th>PTS</th>\n",
       "      <th>REB</th>\n",
       "      <th>SEASON_ID</th>\n",
       "      <th>STL</th>\n",
       "      <th>TEAM_ABBREVIATION</th>\n",
       "      <th>TEAM_ID</th>\n",
       "      <th>TEAM_NAME</th>\n",
       "      <th>TOV</th>\n",
       "      <th>VIDEO_AVAILABLE</th>\n",
       "      <th>WL</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>41</td>\n",
       "      <td>8</td>\n",
       "      <td>38</td>\n",
       "      <td>28</td>\n",
       "      <td>13</td>\n",
       "      <td>0.464</td>\n",
       "      <td>86</td>\n",
       "      <td>56</td>\n",
       "      <td>0.651</td>\n",
       "      <td>23</td>\n",
       "      <td>19</td>\n",
       "      <td>0.826</td>\n",
       "      <td>2016-04-13</td>\n",
       "      <td>0021501226</td>\n",
       "      <td>MIN vs. NOP</td>\n",
       "      <td>240</td>\n",
       "      <td>5</td>\n",
       "      <td>20</td>\n",
       "      <td>35</td>\n",
       "      <td>144</td>\n",
       "      <td>43</td>\n",
       "      <td>22015</td>\n",
       "      <td>14</td>\n",
       "      <td>MIN</td>\n",
       "      <td>1610612750</td>\n",
       "      <td>Minnesota Timberwolves</td>\n",
       "      <td>13</td>\n",
       "      <td>1</td>\n",
       "      <td>W</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>40</td>\n",
       "      <td>5</td>\n",
       "      <td>30</td>\n",
       "      <td>27</td>\n",
       "      <td>14</td>\n",
       "      <td>0.519</td>\n",
       "      <td>91</td>\n",
       "      <td>56</td>\n",
       "      <td>0.615</td>\n",
       "      <td>19</td>\n",
       "      <td>13</td>\n",
       "      <td>0.684</td>\n",
       "      <td>2016-03-29</td>\n",
       "      <td>0021501108</td>\n",
       "      <td>ORL vs. BKN</td>\n",
       "      <td>240</td>\n",
       "      <td>5</td>\n",
       "      <td>29</td>\n",
       "      <td>34</td>\n",
       "      <td>139</td>\n",
       "      <td>35</td>\n",
       "      <td>22015</td>\n",
       "      <td>11</td>\n",
       "      <td>ORL</td>\n",
       "      <td>1610612753</td>\n",
       "      <td>Orlando Magic</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>W</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>28</td>\n",
       "      <td>4</td>\n",
       "      <td>45</td>\n",
       "      <td>29</td>\n",
       "      <td>8</td>\n",
       "      <td>0.276</td>\n",
       "      <td>124</td>\n",
       "      <td>56</td>\n",
       "      <td>0.452</td>\n",
       "      <td>46</td>\n",
       "      <td>27</td>\n",
       "      <td>0.587</td>\n",
       "      <td>2015-12-18</td>\n",
       "      <td>0021500391</td>\n",
       "      <td>DET @ CHI</td>\n",
       "      <td>340</td>\n",
       "      <td>19</td>\n",
       "      <td>35</td>\n",
       "      <td>3</td>\n",
       "      <td>147</td>\n",
       "      <td>64</td>\n",
       "      <td>22015</td>\n",
       "      <td>7</td>\n",
       "      <td>DET</td>\n",
       "      <td>1610612765</td>\n",
       "      <td>Detroit Pistons</td>\n",
       "      <td>11</td>\n",
       "      <td>1</td>\n",
       "      <td>W</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>35</td>\n",
       "      <td>4</td>\n",
       "      <td>34</td>\n",
       "      <td>25</td>\n",
       "      <td>13</td>\n",
       "      <td>0.520</td>\n",
       "      <td>88</td>\n",
       "      <td>53</td>\n",
       "      <td>0.602</td>\n",
       "      <td>16</td>\n",
       "      <td>11</td>\n",
       "      <td>0.688</td>\n",
       "      <td>2016-02-25</td>\n",
       "      <td>0021500855</td>\n",
       "      <td>GSW @ ORL</td>\n",
       "      <td>240</td>\n",
       "      <td>8</td>\n",
       "      <td>21</td>\n",
       "      <td>16</td>\n",
       "      <td>130</td>\n",
       "      <td>42</td>\n",
       "      <td>22015</td>\n",
       "      <td>9</td>\n",
       "      <td>GSW</td>\n",
       "      <td>1610612744</td>\n",
       "      <td>Golden State Warriors</td>\n",
       "      <td>21</td>\n",
       "      <td>1</td>\n",
       "      <td>W</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>30</td>\n",
       "      <td>2</td>\n",
       "      <td>36</td>\n",
       "      <td>23</td>\n",
       "      <td>9</td>\n",
       "      <td>0.391</td>\n",
       "      <td>87</td>\n",
       "      <td>53</td>\n",
       "      <td>0.609</td>\n",
       "      <td>34</td>\n",
       "      <td>27</td>\n",
       "      <td>0.794</td>\n",
       "      <td>2016-01-02</td>\n",
       "      <td>0021500496</td>\n",
       "      <td>SAC vs. PHX</td>\n",
       "      <td>240</td>\n",
       "      <td>10</td>\n",
       "      <td>23</td>\n",
       "      <td>23</td>\n",
       "      <td>142</td>\n",
       "      <td>46</td>\n",
       "      <td>22015</td>\n",
       "      <td>9</td>\n",
       "      <td>SAC</td>\n",
       "      <td>1610612758</td>\n",
       "      <td>Sacramento Kings</td>\n",
       "      <td>15</td>\n",
       "      <td>1</td>\n",
       "      <td>W</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   AST  BLK  DREB  FG3A  FG3M  FG3_PCT  FGA  FGM  FG_PCT  FTA  FTM  FT_PCT  \\\n",
       "0   41    8    38    28    13    0.464   86   56   0.651   23   19   0.826   \n",
       "1   40    5    30    27    14    0.519   91   56   0.615   19   13   0.684   \n",
       "2   28    4    45    29     8    0.276  124   56   0.452   46   27   0.587   \n",
       "3   35    4    34    25    13    0.520   88   53   0.602   16   11   0.688   \n",
       "4   30    2    36    23     9    0.391   87   53   0.609   34   27   0.794   \n",
       "\n",
       "    GAME_DATE     GAME_ID      MATCHUP  MIN  OREB  PF  PLUS_MINUS  PTS  REB  \\\n",
       "0  2016-04-13  0021501226  MIN vs. NOP  240     5  20          35  144   43   \n",
       "1  2016-03-29  0021501108  ORL vs. BKN  240     5  29          34  139   35   \n",
       "2  2015-12-18  0021500391    DET @ CHI  340    19  35           3  147   64   \n",
       "3  2016-02-25  0021500855    GSW @ ORL  240     8  21          16  130   42   \n",
       "4  2016-01-02  0021500496  SAC vs. PHX  240    10  23          23  142   46   \n",
       "\n",
       "  SEASON_ID  STL TEAM_ABBREVIATION     TEAM_ID               TEAM_NAME  TOV  \\\n",
       "0     22015   14               MIN  1610612750  Minnesota Timberwolves   13   \n",
       "1     22015   11               ORL  1610612753           Orlando Magic   10   \n",
       "2     22015    7               DET  1610612765         Detroit Pistons   11   \n",
       "3     22015    9               GSW  1610612744   Golden State Warriors   21   \n",
       "4     22015    9               SAC  1610612758        Sacramento Kings   15   \n",
       "\n",
       "   VIDEO_AVAILABLE WL  \n",
       "0                1  W  \n",
       "1                1  W  \n",
       "2                1  W  \n",
       "3                1  W  \n",
       "4                1  W  "
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gameids = goldsberry.GameIDs()\n",
    "gameids2015 = pd.DataFrame(gameids.game_list())\n",
    "gameids2015.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Like the PlayerList() class, the GameIDs() class defaults to the current season. If we want the 2006-07 season, we need to identify and change the proper parameters. We can see the available parameters to set by printing the `api_params` attribute."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Direction': 'DESC',\n",
       " 'LeagueID': '00',\n",
       " 'PlayerOrTeam': 'T',\n",
       " 'Season': '2015-16',\n",
       " 'SeasonType': 'Regular Season',\n",
       " 'Sorter': 'FGM'}"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gameids.api_params"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "From there, we can see we should set the `Season` value to `2006-07`. Once we set the parameter, we need to get new data and then save the new data as a data frame to a new object."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AST</th>\n",
       "      <th>BLK</th>\n",
       "      <th>DREB</th>\n",
       "      <th>FG3A</th>\n",
       "      <th>FG3M</th>\n",
       "      <th>FG3_PCT</th>\n",
       "      <th>FGA</th>\n",
       "      <th>FGM</th>\n",
       "      <th>FG_PCT</th>\n",
       "      <th>FTA</th>\n",
       "      <th>FTM</th>\n",
       "      <th>FT_PCT</th>\n",
       "      <th>GAME_DATE</th>\n",
       "      <th>GAME_ID</th>\n",
       "      <th>MATCHUP</th>\n",
       "      <th>MIN</th>\n",
       "      <th>OREB</th>\n",
       "      <th>PF</th>\n",
       "      <th>PLUS_MINUS</th>\n",
       "      <th>PTS</th>\n",
       "      <th>REB</th>\n",
       "      <th>SEASON_ID</th>\n",
       "      <th>STL</th>\n",
       "      <th>TEAM_ABBREVIATION</th>\n",
       "      <th>TEAM_ID</th>\n",
       "      <th>TEAM_NAME</th>\n",
       "      <th>TOV</th>\n",
       "      <th>VIDEO_AVAILABLE</th>\n",
       "      <th>WL</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>43</td>\n",
       "      <td>5</td>\n",
       "      <td>28</td>\n",
       "      <td>31</td>\n",
       "      <td>17</td>\n",
       "      <td>0.548</td>\n",
       "      <td>117</td>\n",
       "      <td>61</td>\n",
       "      <td>0.521</td>\n",
       "      <td>27</td>\n",
       "      <td>22</td>\n",
       "      <td>0.815</td>\n",
       "      <td>2006-12-07</td>\n",
       "      <td>0020600271</td>\n",
       "      <td>PHX @ NJN</td>\n",
       "      <td>290</td>\n",
       "      <td>11</td>\n",
       "      <td>28</td>\n",
       "      <td>4</td>\n",
       "      <td>161</td>\n",
       "      <td>39</td>\n",
       "      <td>22006</td>\n",
       "      <td>10</td>\n",
       "      <td>PHX</td>\n",
       "      <td>1610612756</td>\n",
       "      <td>Phoenix Suns</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>W</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>37</td>\n",
       "      <td>3</td>\n",
       "      <td>40</td>\n",
       "      <td>21</td>\n",
       "      <td>10</td>\n",
       "      <td>0.476</td>\n",
       "      <td>107</td>\n",
       "      <td>60</td>\n",
       "      <td>0.561</td>\n",
       "      <td>31</td>\n",
       "      <td>27</td>\n",
       "      <td>0.871</td>\n",
       "      <td>2006-12-07</td>\n",
       "      <td>0020600271</td>\n",
       "      <td>NJN vs. PHX</td>\n",
       "      <td>290</td>\n",
       "      <td>10</td>\n",
       "      <td>29</td>\n",
       "      <td>-4</td>\n",
       "      <td>157</td>\n",
       "      <td>50</td>\n",
       "      <td>22006</td>\n",
       "      <td>2</td>\n",
       "      <td>NJN</td>\n",
       "      <td>1610612751</td>\n",
       "      <td>New Jersey Nets</td>\n",
       "      <td>17</td>\n",
       "      <td>0</td>\n",
       "      <td>L</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>39</td>\n",
       "      <td>9</td>\n",
       "      <td>38</td>\n",
       "      <td>14</td>\n",
       "      <td>5</td>\n",
       "      <td>0.357</td>\n",
       "      <td>98</td>\n",
       "      <td>54</td>\n",
       "      <td>0.551</td>\n",
       "      <td>29</td>\n",
       "      <td>17</td>\n",
       "      <td>0.586</td>\n",
       "      <td>2007-01-24</td>\n",
       "      <td>0020600628</td>\n",
       "      <td>UTA vs. MEM</td>\n",
       "      <td>265</td>\n",
       "      <td>18</td>\n",
       "      <td>32</td>\n",
       "      <td>-2</td>\n",
       "      <td>130</td>\n",
       "      <td>56</td>\n",
       "      <td>22006</td>\n",
       "      <td>4</td>\n",
       "      <td>UTA</td>\n",
       "      <td>1610612762</td>\n",
       "      <td>Utah Jazz</td>\n",
       "      <td>14</td>\n",
       "      <td>0</td>\n",
       "      <td>L</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>26</td>\n",
       "      <td>6</td>\n",
       "      <td>37</td>\n",
       "      <td>22</td>\n",
       "      <td>8</td>\n",
       "      <td>0.364</td>\n",
       "      <td>95</td>\n",
       "      <td>54</td>\n",
       "      <td>0.568</td>\n",
       "      <td>19</td>\n",
       "      <td>15</td>\n",
       "      <td>0.789</td>\n",
       "      <td>2007-01-21</td>\n",
       "      <td>0020600604</td>\n",
       "      <td>PHX vs. MIN</td>\n",
       "      <td>240</td>\n",
       "      <td>12</td>\n",
       "      <td>21</td>\n",
       "      <td>29</td>\n",
       "      <td>131</td>\n",
       "      <td>49</td>\n",
       "      <td>22006</td>\n",
       "      <td>6</td>\n",
       "      <td>PHX</td>\n",
       "      <td>1610612756</td>\n",
       "      <td>Phoenix Suns</td>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>W</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>34</td>\n",
       "      <td>5</td>\n",
       "      <td>35</td>\n",
       "      <td>32</td>\n",
       "      <td>12</td>\n",
       "      <td>0.375</td>\n",
       "      <td>104</td>\n",
       "      <td>54</td>\n",
       "      <td>0.519</td>\n",
       "      <td>13</td>\n",
       "      <td>8</td>\n",
       "      <td>0.615</td>\n",
       "      <td>2007-01-07</td>\n",
       "      <td>0020600502</td>\n",
       "      <td>PHX vs. GSW</td>\n",
       "      <td>240</td>\n",
       "      <td>11</td>\n",
       "      <td>24</td>\n",
       "      <td>23</td>\n",
       "      <td>128</td>\n",
       "      <td>46</td>\n",
       "      <td>22006</td>\n",
       "      <td>11</td>\n",
       "      <td>PHX</td>\n",
       "      <td>1610612756</td>\n",
       "      <td>Phoenix Suns</td>\n",
       "      <td>15</td>\n",
       "      <td>0</td>\n",
       "      <td>W</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   AST  BLK  DREB  FG3A  FG3M  FG3_PCT  FGA  FGM  FG_PCT  FTA  FTM  FT_PCT  \\\n",
       "0   43    5    28    31    17    0.548  117   61   0.521   27   22   0.815   \n",
       "1   37    3    40    21    10    0.476  107   60   0.561   31   27   0.871   \n",
       "2   39    9    38    14     5    0.357   98   54   0.551   29   17   0.586   \n",
       "3   26    6    37    22     8    0.364   95   54   0.568   19   15   0.789   \n",
       "4   34    5    35    32    12    0.375  104   54   0.519   13    8   0.615   \n",
       "\n",
       "    GAME_DATE     GAME_ID      MATCHUP  MIN  OREB  PF  PLUS_MINUS  PTS  REB  \\\n",
       "0  2006-12-07  0020600271    PHX @ NJN  290    11  28           4  161   39   \n",
       "1  2006-12-07  0020600271  NJN vs. PHX  290    10  29          -4  157   50   \n",
       "2  2007-01-24  0020600628  UTA vs. MEM  265    18  32          -2  130   56   \n",
       "3  2007-01-21  0020600604  PHX vs. MIN  240    12  21          29  131   49   \n",
       "4  2007-01-07  0020600502  PHX vs. GSW  240    11  24          23  128   46   \n",
       "\n",
       "  SEASON_ID  STL TEAM_ABBREVIATION     TEAM_ID        TEAM_NAME  TOV  \\\n",
       "0     22006   10               PHX  1610612756     Phoenix Suns   12   \n",
       "1     22006    2               NJN  1610612751  New Jersey Nets   17   \n",
       "2     22006    4               UTA  1610612762        Utah Jazz   14   \n",
       "3     22006    6               PHX  1610612756     Phoenix Suns    8   \n",
       "4     22006   11               PHX  1610612756     Phoenix Suns   15   \n",
       "\n",
       "   VIDEO_AVAILABLE WL  \n",
       "0                0  W  \n",
       "1                0  L  \n",
       "2                0  L  \n",
       "3                0  W  \n",
       "4                0  W  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gameids.get_new_data(Season='2006-07')\n",
    "gameids2006 = pd.DataFrame(gameids.game_list())\n",
    "gameids2006.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A quick filter for team names that contain 'Suns' returns all games for the Suns for the 2006-07 season"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>AST</th>\n",
       "      <th>BLK</th>\n",
       "      <th>DREB</th>\n",
       "      <th>FG3A</th>\n",
       "      <th>FG3M</th>\n",
       "      <th>FG3_PCT</th>\n",
       "      <th>FGA</th>\n",
       "      <th>FGM</th>\n",
       "      <th>FG_PCT</th>\n",
       "      <th>FTA</th>\n",
       "      <th>FTM</th>\n",
       "      <th>FT_PCT</th>\n",
       "      <th>GAME_DATE</th>\n",
       "      <th>GAME_ID</th>\n",
       "      <th>MATCHUP</th>\n",
       "      <th>MIN</th>\n",
       "      <th>OREB</th>\n",
       "      <th>PF</th>\n",
       "      <th>PLUS_MINUS</th>\n",
       "      <th>PTS</th>\n",
       "      <th>REB</th>\n",
       "      <th>SEASON_ID</th>\n",
       "      <th>STL</th>\n",
       "      <th>TEAM_ABBREVIATION</th>\n",
       "      <th>TEAM_ID</th>\n",
       "      <th>TEAM_NAME</th>\n",
       "      <th>TOV</th>\n",
       "      <th>VIDEO_AVAILABLE</th>\n",
       "      <th>WL</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>43</td>\n",
       "      <td>5</td>\n",
       "      <td>28</td>\n",
       "      <td>31</td>\n",
       "      <td>17</td>\n",
       "      <td>0.548</td>\n",
       "      <td>117</td>\n",
       "      <td>61</td>\n",
       "      <td>0.521</td>\n",
       "      <td>27</td>\n",
       "      <td>22</td>\n",
       "      <td>0.815</td>\n",
       "      <td>2006-12-07</td>\n",
       "      <td>0020600271</td>\n",
       "      <td>PHX @ NJN</td>\n",
       "      <td>290</td>\n",
       "      <td>11</td>\n",
       "      <td>28</td>\n",
       "      <td>4</td>\n",
       "      <td>161</td>\n",
       "      <td>39</td>\n",
       "      <td>22006</td>\n",
       "      <td>10</td>\n",
       "      <td>PHX</td>\n",
       "      <td>1610612756</td>\n",
       "      <td>Phoenix Suns</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>W</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>26</td>\n",
       "      <td>6</td>\n",
       "      <td>37</td>\n",
       "      <td>22</td>\n",
       "      <td>8</td>\n",
       "      <td>0.364</td>\n",
       "      <td>95</td>\n",
       "      <td>54</td>\n",
       "      <td>0.568</td>\n",
       "      <td>19</td>\n",
       "      <td>15</td>\n",
       "      <td>0.789</td>\n",
       "      <td>2007-01-21</td>\n",
       "      <td>0020600604</td>\n",
       "      <td>PHX vs. MIN</td>\n",
       "      <td>240</td>\n",
       "      <td>12</td>\n",
       "      <td>21</td>\n",
       "      <td>29</td>\n",
       "      <td>131</td>\n",
       "      <td>49</td>\n",
       "      <td>22006</td>\n",
       "      <td>6</td>\n",
       "      <td>PHX</td>\n",
       "      <td>1610612756</td>\n",
       "      <td>Phoenix Suns</td>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>W</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>34</td>\n",
       "      <td>5</td>\n",
       "      <td>35</td>\n",
       "      <td>32</td>\n",
       "      <td>12</td>\n",
       "      <td>0.375</td>\n",
       "      <td>104</td>\n",
       "      <td>54</td>\n",
       "      <td>0.519</td>\n",
       "      <td>13</td>\n",
       "      <td>8</td>\n",
       "      <td>0.615</td>\n",
       "      <td>2007-01-07</td>\n",
       "      <td>0020600502</td>\n",
       "      <td>PHX vs. GSW</td>\n",
       "      <td>240</td>\n",
       "      <td>11</td>\n",
       "      <td>24</td>\n",
       "      <td>23</td>\n",
       "      <td>128</td>\n",
       "      <td>46</td>\n",
       "      <td>22006</td>\n",
       "      <td>11</td>\n",
       "      <td>PHX</td>\n",
       "      <td>1610612756</td>\n",
       "      <td>Phoenix Suns</td>\n",
       "      <td>15</td>\n",
       "      <td>0</td>\n",
       "      <td>W</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>34</td>\n",
       "      <td>7</td>\n",
       "      <td>34</td>\n",
       "      <td>43</td>\n",
       "      <td>13</td>\n",
       "      <td>0.302</td>\n",
       "      <td>105</td>\n",
       "      <td>52</td>\n",
       "      <td>0.495</td>\n",
       "      <td>28</td>\n",
       "      <td>22</td>\n",
       "      <td>0.786</td>\n",
       "      <td>2006-12-22</td>\n",
       "      <td>0020600391</td>\n",
       "      <td>PHX vs. WAS</td>\n",
       "      <td>265</td>\n",
       "      <td>12</td>\n",
       "      <td>22</td>\n",
       "      <td>-5</td>\n",
       "      <td>139</td>\n",
       "      <td>46</td>\n",
       "      <td>22006</td>\n",
       "      <td>2</td>\n",
       "      <td>PHX</td>\n",
       "      <td>1610612756</td>\n",
       "      <td>Phoenix Suns</td>\n",
       "      <td>12</td>\n",
       "      <td>0</td>\n",
       "      <td>L</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>36</td>\n",
       "      <td>2</td>\n",
       "      <td>28</td>\n",
       "      <td>34</td>\n",
       "      <td>14</td>\n",
       "      <td>0.412</td>\n",
       "      <td>90</td>\n",
       "      <td>50</td>\n",
       "      <td>0.556</td>\n",
       "      <td>28</td>\n",
       "      <td>23</td>\n",
       "      <td>0.821</td>\n",
       "      <td>2007-01-15</td>\n",
       "      <td>0020600563</td>\n",
       "      <td>PHX @ MEM</td>\n",
       "      <td>240</td>\n",
       "      <td>10</td>\n",
       "      <td>17</td>\n",
       "      <td>15</td>\n",
       "      <td>137</td>\n",
       "      <td>38</td>\n",
       "      <td>22006</td>\n",
       "      <td>9</td>\n",
       "      <td>PHX</td>\n",
       "      <td>1610612756</td>\n",
       "      <td>Phoenix Suns</td>\n",
       "      <td>13</td>\n",
       "      <td>0</td>\n",
       "      <td>W</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    AST  BLK  DREB  FG3A  FG3M  FG3_PCT  FGA  FGM  FG_PCT  FTA  FTM  FT_PCT  \\\n",
       "0    43    5    28    31    17    0.548  117   61   0.521   27   22   0.815   \n",
       "3    26    6    37    22     8    0.364   95   54   0.568   19   15   0.789   \n",
       "4    34    5    35    32    12    0.375  104   54   0.519   13    8   0.615   \n",
       "10   34    7    34    43    13    0.302  105   52   0.495   28   22   0.786   \n",
       "18   36    2    28    34    14    0.412   90   50   0.556   28   23   0.821   \n",
       "\n",
       "     GAME_DATE     GAME_ID      MATCHUP  MIN  OREB  PF  PLUS_MINUS  PTS  REB  \\\n",
       "0   2006-12-07  0020600271    PHX @ NJN  290    11  28           4  161   39   \n",
       "3   2007-01-21  0020600604  PHX vs. MIN  240    12  21          29  131   49   \n",
       "4   2007-01-07  0020600502  PHX vs. GSW  240    11  24          23  128   46   \n",
       "10  2006-12-22  0020600391  PHX vs. WAS  265    12  22          -5  139   46   \n",
       "18  2007-01-15  0020600563    PHX @ MEM  240    10  17          15  137   38   \n",
       "\n",
       "   SEASON_ID  STL TEAM_ABBREVIATION     TEAM_ID     TEAM_NAME  TOV  \\\n",
       "0      22006   10               PHX  1610612756  Phoenix Suns   12   \n",
       "3      22006    6               PHX  1610612756  Phoenix Suns    8   \n",
       "4      22006   11               PHX  1610612756  Phoenix Suns   15   \n",
       "10     22006    2               PHX  1610612756  Phoenix Suns   12   \n",
       "18     22006    9               PHX  1610612756  Phoenix Suns   13   \n",
       "\n",
       "    VIDEO_AVAILABLE WL  \n",
       "0                 0  W  \n",
       "3                 0  W  \n",
       "4                 0  W  \n",
       "10                0  L  \n",
       "18                0  W  "
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "suns_logs = gameids2006.ix[gameids2006['TEAM_NAME'].str.contains('Suns')]\n",
    "suns_logs.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can verify all of the games are there by checking the shape of the data frame."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(82, 29)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "suns_logs.shape"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
